package com.tarena.lbs.basic.web.filters;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;
//@Component
@Slf4j
@Order(0)
public class MyFilter01 implements Filter {
    /**
     * 过滤器 核心过滤逻辑 请求进入这个方法 到底要怎么过滤
     * @param servletRequest
     * @param servletResponse
     * @param filterChain
     * @throws IOException
     * @throws ServletException
     */
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //如果想要让当前这个过滤器 正常的加入过滤链中 必须调用一个过滤连对象的过滤方法 连接上下文中的其他组件
        log.info("myfilter01生效了");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
